﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Odbc;

namespace MyLibrary.Data.DatabaseMonitor
{
    /// <summary>
    /// 监控器事件参数
    /// </summary>
    public class DatabaseMonitorEventArgs : EventArgs
    {
        private string _monitorName;
        private DateTime _monitorTime;
        private DateTime _nextmonitorTime;
        private MonitorResult _result;
        private int _recordIncrease;

        /// <summary>
        /// 监视器的名称
        /// </summary>
        public string MonitorName
        {
            get
            {
                return this._monitorName;
            }
            set
            {
                this._monitorName = value;
            }
        }

        /// <summary>
        /// 本次次监控的时间
        /// </summary>
        public DateTime MonitorTime
        {
            get
            {
                return this._monitorTime;
            }
            set
            {
                this._monitorTime = value;
            }
        }

        /// <summary>
        /// 下次监控的时间
        /// </summary>
        public DateTime NextMonitorTime
        {
            get
            {
                return this._nextmonitorTime;
            }
            set
            {
                this._nextmonitorTime = value;
            }
        }

        /// <summary>
        /// 监控结果
        /// </summary>
        public MonitorResult Result
        {
            get
            {
                return this._result;
            }
            set
            {
                this._result = value;
            }
        }

        /// <summary>
        /// 监控表的记录增长数量
        /// </summary>
        public int RecordIncrease
        {
            get
            {
                return this._recordIncrease;
            }
            set
            {
                this._recordIncrease = value;
            }
        }
    }

    /// <summary>
    /// 监控结果
    /// </summary>
    public enum MonitorResult
    {
        /// <summary>
        /// 数据库正常
        /// </summary>
        Alive = 0,
        /// <summary>
        /// 数据不正常
        /// </summary>
        Death = 1,
        /// <summary>
        /// 监控错误
        /// </summary>
        Error = 2,
        /// <summary>
        /// 记录增加
        /// </summary>
        Increase = 3,
        /// <summary>
        /// 记录没有变化
        /// </summary>
        Unchanging = 4,
        /// <summary>
        /// 发出警告
        /// </summary>
        Warming = 5,
        /// <summary>
        /// 第一次报告监控表的数量
        /// </summary>
        FirstReport = 6
    }

    /// <summary>
    /// 监控器状态
    /// </summary>
    public enum MonitorStatus
    {
        /// <summary>
        /// 未启动
        /// </summary>
        NoStart = 0,
        /// <summary>
        /// 正在运行
        /// </summary>
        Running = 1,
        /// <summary>
        /// 停止
        /// </summary>
        Stop = 2,
        /// <summary>
        /// 暂停
        /// </summary>
        Pause = 3,
    }
}
